#ifndef MAPCONTENT_H
#define MAPCONTENT_H

#include "actor.h"
#include "MapZone.h"
#include "ObjectBucket.h"

/**
 * Entities on a map.
 */
struct MapContent
{
    MapContent(Map *);
    ~MapContent();

    /**
     * Allocates a unique ID for an actor on this map.
     */
    bool allocate(Actor *);

    /**
     * Deallocates an ID.
     */
    void deallocate(Actor *);

    /**
     * Fills a region of zones within the range of a point.
     */
    void fillRegion(std::vector< unsigned > &, const Point &, int) const;

    /**
     * Fills a region of zones inside a rectangle.
     */
    void fillRegion(std::vector< unsigned > &, const Rectangle &) const;

    /**
     * Gets zone at given position.
     */
    MapZone &getZone(const Point &pos) const;

    /**
     * Things (items, characters, monsters, etc) located on the map.
     */
    std::vector< Thing * > things;

    /**
     * Buckets of MovingObjects located on the map, referenced by ID.
     */
    ObjectBucket *buckets[256];

    int last_bucket; /**< Last bucket acted upon. */

    /**
     * Partition of the Objects, depending on their position on the map.
     */
    MapZone *zones;

    unsigned short mapWidth;  /**< Width with respect to zones. */
    unsigned short mapHeight; /**< Height with respect to zones. */
};



#endif // MAPCONTENT_H
